﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LevenBlog.Core.Data;

namespace LevenBlog.Core.Install {
    public sealed class OperationContext : IDisposable {
        public IFactory DbFactory { get; private set; }

        public IDbProvider DbProvider { get; private set; }

        public OperationContext() {
            DbFactory = ProviderManager.Factory;
            DbProvider = DbFactory.CreateDbProvider();
        }

        public OperationContext(IFactory factory) {
            DbFactory = factory;
            DbProvider = DbFactory.CreateDbProvider();
        }

        #region IDisposable Members

        public void Dispose() {
            if (DbProvider != null) {
                DbProvider.Dispose();
            }
        }

        #endregion
    }
}
